package bikeAD;

import io.restassured.RestAssured;
import io.restassured.http.ContentType;
import io.restassured.response.Response;
import bikeAD.setRedis;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;

import java.util.HashMap;
import java.util.List;

import static io.restassured.RestAssured.given;
import static io.restassured.config.EncoderConfig.encoderConfig;

public class test0002_login extends getClassName {

    @Before
    public void before() {
        System.out.println(getClassName()+"开始执行……");
    }

    @After
    public void after() {
        System.out.println(getClassName()+"执行完毕……");
        System.out.println();
    }

    @Test
    public void test_login(){
        //定义一个测试的手机号，并设置短信验证码
        String phoneNum = "13066889177";
        setRedis redis = new setRedis();
        redis.setVcode(phoneNum);//将手机验证码设置为1234

        //登录接口
        String graphql = "mutation{\n  login(mobile:\""+phoneNum+"\", code:\"1234\"){\n    basic{\n      city_ids,\n      id,\n      mobile,\n      nickname,\n      role_codes,\n      status\n    }\n    token{\n      refresh_token,\n      refresh_token_expire,\n      token,\n      token_expire,\n      user_id\n    }\n  }\n}";
        graphql_method method = new graphql_method();
        method.graphql_post_without_token(graphql);

    }
}
